Process. This week I'm designing a board that controls a DC motor through a microcontroller. Components I'm using:
- Servo:MG90S
- MC: Seed Studio XIAO ESP32C3
- 3-6V DC motor: 130 DC Motor
- 5V Battery
- Single - sided copper board
Milling Machine Info: 1/32" Flat end mill; 1/64" flat end mill Software used: Fusion 360 - Schematic & Layout; Arduino IDE - Microcontroller coding.
The idea of Servo motor really interests me as I've never seen or come across this before. So I made a conceptual comparison table to summarize thigns I learned along the wayServo Motor vs Conventional Motor
| Feature | Servo Motor | Conventional Motor |
|---|---|---|
| Control | Precise position control via PWM signal | Continuous rotation only, no positional control |
| Feedback | Built-in potentiometer gives position feedback | No feedback โ open loop system |
| Usage | Robotics, camera gimbals, locks, precise actuation | Fans, wheels, pumps, general spinning |
| Power | Usually 5โ6V low power | Wide range (3โ24V+) |
| Signal Pins | 3 wires: Power, Ground, Signal | 2 wires: Power, Ground |
Schematic Design in Fusion
Finished Board with Bantam CNC milling machine
Servo Test Code
/***********
Modified 4 Nov 2025
by Tony Wang
see http://www.arduino.cc/en/Tutorial/Sweep
for a description of the original code
***********/
#include
Servo myservo; // create servo object to control a servo
int pos = 0; // variable to store the servo position
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
int servoPin = 17;
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
int servoPin = 7; // Used
#else
int servoPin = 18;
#endif
// int servoPin = 4;
void setup() {
// Allow allocation of all timers
ESP32PWM::allocateTimer(0);
ESP32PWM::allocateTimer(1);
ESP32PWM::allocateTimer(2);
ESP32PWM::allocateTimer(3);
myservo.setPeriodHertz(50); // standard 50 hz servo
myservo.attach(servoPin, 500, 2500); //
// using default min/max of 500us and 2500us
// different servos may require different min/max settings
// for an accurate 0 to 180 sweep
}
void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
const int motorPin = 20;
void setup() {
pinMode(motorPin, OUTPUT);
}
void loop() {
//Motor
int speed;
for (speed = 0; speed <=255; speed +=50){
analogWrite(motorPin, speed);
delay(1000);
}
analogWrite(motorPin, 0);
delay(1000);
}